
package hibernate;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.EntityManager;
import org.hibernate.HibernateException;
import region.*;

public class Main 
{
    
   
    public static void main(String[] args) 
    {
       try
       { 
        EntityManagerFactory factory = Persistence.createEntityManagerFactory("persistence");
        EntityManager em = factory.createEntityManager();
        em.getTransaction().begin();
        
        Pais pais = new Pais();
        pais.setNombre("Inglaterra");
        em.persist(pais);     
               
        Categoria c = new Categoria();
        c.setCategoria("Profesores");
        em.persist(c);  
        em.getTransaction().commit();
        
        
        em.close();
       }
       catch(HibernateException e){System.out.println("error "+e);}
    }
    
}
